<template>
  <div>
    <el-form label-width="80px" style="width: 30%">
      <el-form-item label="订单来源">
        <el-select v-model="rid.paymentWay" placeholder="请选择">
          <el-option value="天猫"></el-option>
          <el-option value="淘宝"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="车牌号">
        <el-input v-model="rid.carPlate"></el-input>
      </el-form-item>

      <el-form-item label="预检时间">
        <el-date-picker
          v-model="rid.placeTestTime"
          type="date"
          placeholder="选择日期"
        >
        </el-date-picker>
      </el-form-item>

      <el-form-item label="实付价格">
        <el-input v-model="rid.price"></el-input>
      </el-form-item>

      <el-form-item label="客户姓名">
        <el-input v-model="rid.customerName"></el-input>
      </el-form-item>

      <el-form-item label="客户电话">
        <el-input v-model="rid.customerPhone"></el-input>
      </el-form-item>

      <el-form-item label="居住地址">
        <pickArea @getSite="getSite"></pickArea>
        <el-input v-model="rid.address"></el-input>
      </el-form-item>

      <el-form-item label="行驶证或车辆照片">
        <el-upload
          drag
          :action="$http.defaults.baseURL + '/file/uploadFile'"
          multiple
          :on-success="uploadsaa"
        >
          <i class="el-icon-upload"></i>
          <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
          <div class="el-upload__tip" slot="tip">
            只能上传jpg/png文件，且不超过500kb
          </div>
        </el-upload>
      </el-form-item>

      <el-form-item label="电子保单(非必填)">
        <el-upload
          drag
          :action="$http.defaults.baseURL + '/file/uploadFile'"
          multiple
          :on-success="uploadsbb"
        >
          <i class="el-icon-upload"></i>
          <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
          <div class="el-upload__tip" slot="tip">
            只能上传jpg/png文件，且不超过500kb
          </div>
        </el-upload>
      </el-form-item>

      <el-form-item label="备注">
        <el-input
          type="textarea"
          :rows="2"
          placeholder="请输入内容"
          v-model="rid.remarks"
        >
        </el-input>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="onSubmit">立即创建</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import pickArea from "../../components/pickArea.vue";
export default {
  data() {
    return {
      rid: {
        licenseImgs: [],
        policyImgs: [],
      },
    };
  },
  components: { pickArea },
  methods: {
    getSite(prov, city, district) {
      // console.log(prov,city,district);
      this.rid.province = prov;
      this.rid.city = city;
      this.rid.area = district;
    },
    uploadsaa(response) {
      //   console.log(this.tablelist.merchantLicenseImg);
      this.rid.licenseImgs.push(response.object.url);
    },
    uploadsbb(response) {
      //   console.log(this.tablelist.merchantLicenseImg);
      this.rid.policyImgs.push(response.object.url);
    },
    onSubmit() {
      this.$http.post("/order/placeCStoreOrder", this.rid).then(res => {
        console.log(res);
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.el-input {
  width: 100%;
}
</style>